#include <cstdio>

struct Tracer {
  Tracer(const char *name) : name_(name) { printf("%s 构造完成\n", name_); }
  ~Tracer() { printf("%s 析构完成\n", name_); }

private:
  const char *name_;
};

static Tracer static_tracer("静态变量Tracer");
thread_local Tracer thread_local_tracer("线程局部变量Tracer");

int main(int argc, char **argv) {
  printf("main函数开始\n");
  Tracer tracer("自动变量Tracer");
  printf("----------\n");
  Tracer *tracer_ptr = new Tracer("动态存储Tracer");
  printf("main函数结束\n");
  // 没有手动删除 tracer_ptr，因此 tracer_ptr 的析构函数不会被调用
  // delete tracer_ptr;

  return 0;
}
